package com.juyu.miliao.api.dao.mysql;

import com.juyu.miliao.common.domain.SanGuoGameRankingList;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: 卜加超
 * @Date: 2019/8/7 13:28
 * @Description:
 */
@Repository
public class SanGuoGameRankingListDao {
    @Resource
    private SqlSession sqlSession;

    /**
     * 根据用户id获取排行榜记录
     * @param userId
     * @return
     */
    public SanGuoGameRankingList getSanGuoRankingListByUserId(long userId) {
        return sqlSession.selectOne("getSanGuoRankingListByUserId",userId);
    }

    /**
     * 获取榜单
     * @return
     */
    public List<SanGuoGameRankingList> getSanGuoGameRankingList() {
        return sqlSession.selectList("getSanGuoGameRankingList");
    }

    public int updateSanGuoRankingListByUserId(Long userId) {
        return sqlSession.update("updateSanGuoRankingListByUserId",userId);
    }
}
